1. Field of the Invention
The present invention relates to a control to read/write data from and into a magnetic disk unit, and specifically, relates to a logical operation for input-output data.
2. Background Art
As a storage device for computer devices, a hard disk unit is widely used, which is randomly accessible and the read/write process is quick. Physically, the hard disk unit magnetically records and reads data into and from a data recording area of a magnetic disk, which is partitioned into tracks and sectors. However, data is inputted/outputted under management of a file system in terms of logical units called blocks independently of the physical partitions of the data recording area. The blocks constitute a file and is used in computer processing. The file system manages files on an external storage device and is provided as a function of an operating system (OS) or the like.
FIG. 7 is a diagram showing relationship between a general hard disk unit and a file system.
Referring to FIG. 7, a hard disk unit 710 includes a magnetic disk 711 as a recording medium, a controller 712 which controls reading and writing data from and into the magnetic disk 711, and a nonvolatile memory 713 used as a cache memory. The file system 720 issues requests (input and output requests) for the hard disk unit 710 to read and write data in block units. Also, the file system 720 uses an address called a logical block address (LBA) (see “Transistor Gijutsu”, p. 180-181, December 2001, CQ publishing, Co., Ltd., for example) to identify a block stored in the hard disk unit 710.
In a system like this, when a file I/O (input/output) request arrives at the file system 720 from an application or the like, the file system 720 creates and issues to the hard disk unit 710 input/output requests necessary to handle the request. Next, when the file system 720 issues a write request to the hard disk unit 710, such as a case where there is a request to write data into a file, the file system 720 determines a layout of data on the hard disk unit 710.
The hard disk unit makes a magnetic head to seek to a desired track on a rotating magnetic disk to read and write data. For this structural reason, when the hard disk unit performs operations for blocks having consecutive LBAs in both reading and writing data (sequential reading and writing), the seek operation of the magnetic head is minimized, and the performance thereof is maximized. However, it is very difficult that the hard disk unit 710 translates the layout of blocks which has been translated into LBAs in the input/output requests outputted from the file system 720 into a layout enabling a good input/output performance. This is because it is generally impossible to estimate the layout structure on the hard disk unit 710 from a write designation having been translated into LBAs.
Therefore, the file system 720 has hitherto determined a proper layout on the hard disk unit 710 to improve the performance of executing input/output requests.
In writing data, in the case where write requests for a plurality of files arrive at the hard disk unit 710 in parallel, if sequential writing is performed in the arrival order of the write requests, blocks storing data of the respective files are stored between blocks of other files. This state is called fragmentation.
On the other hand, in reading data, even when read requests for a plurality of files are simultaneously generated, since the contents of the files can be read ahead and cached in a file system level, it is desirable that the files are sequentially arranged, namely, it is desirable that there is no fragmentation.
Accordingly, the conventional file system 720 often takes a following strategy. If possible, the file system 720 does not immediately perform writing into the hard disk unit 710 in response to the write request and stores to some extent data to be written in the cache memory. The file system 720 then determines a proper layout and performs writing into the magnetic disk. By storing the data in the cache memory, input/output transactions concerning writing into the same area are reduced, and unnecessary movement of the magnetic head of the hard disk unit 710 is reduced, thus increasing writing throughput, and as well as a layout can be employed which allows less fragmentation in order not to bring disadvantages in reading.